package com.example.demo.com.example.demo.controller.com.example.demo.com.example.demo.controller;

import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;

// 这个包主要是单元格的格式处理
public class cell {
    public static void main(String[] args) throws  Exception {
        HSSFWorkbook sheets = new HSSFWorkbook();//定义一个新的工作簿
        HSSFSheet sheet= sheets.createSheet("第一给sheet页");//创建sheet页

        HSSFRow row = sheet.createRow(0);//创建行
        HSSFCell cell = row.createCell(0);//创建单元格
        cell.setCellValue("1");//设置值
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\我的第一个workboot1cell.xls");

        sheets.write(fileOutputStream);
        fileOutputStream.close();

    }
    private  static  void  create(Workbook workbook, Row row, short colum,short hight,short valiah){
        Cell cell = row.createCell(colum);
        cell.setCellValue(new HSSFRichTextString("Alight It"));
        CellStyle cellStyle = workbook.createCellStyle();
        cellStyle.setAlignment(valiah);
        cell.setCellStyle();
    }
}
